var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = t("ConfS"),
    r = t("fightManager"),
    a = t("cd"),
    i = (function () {
        function t(t, e, o) {
            void 0 === o && (o = !1),
                (this.data = n.DatasManager.SkillDatasById[t]),
                (this.buff = e.get_buff_data(t, o)),
                (this.cd = new a.default(this.data.CDMax, this.data.CdBeforeUsed));
        }
        return (
            (t.prototype.getProgress = function () {
                return this.cd.progress();
            }),
            (t.prototype.is_nengliang = function (t) {
                return t.mp.value >= this.data.nengliang;
            }),
            (t.prototype.isOutScene = function (t) {
                var e = r.default.inst.bg.width / 2;
                return t > e - 50 || t < 50 - e;
            }),
            (t.prototype.get_Best_attack_point = function (t, e, o) {
                var n = Math.abs(t.node.x - e.node.x),
                    r = this.data.radius[1] + e.node.width,
                    a = this.data.radius[0],
                    i = (r - a) / 2 + a;
                if (r >= n && n >= a) return {x: t.node.x, y: e.node.y};
                var s = {x: e.node.x + i, y: e.node.y},
                    c = {x: e.node.x - i, y: e.node.y};
                return this.isOutScene(s.x)
                    ? c
                    : this.isOutScene(c.x)
                    ? s
                    : o
                    ? cc.Vec2.distance(o, c) > cc.Vec2.distance(o, s)
                        ? s
                        : c
                    : cc.Vec2.distance(t.node, c) > cc.Vec2.distance(t.node, s)
                    ? s
                    : c;
            }),
            (t.prototype.is_Can_Attack_Enemy = function (t, e) {
                var o = Math.abs(t.node.x - e.node.x),
                    n = Math.abs(t.node.y - e.node.y),
                    r = this.data.radius[1],
                    a = this.data.radius[0];
                return r >= o && o >= a && n <= this.data.radius[2];
            }),
            (t.prototype.update = function (t) {
                this.cd.update(t);
            }),
            (t.prototype.use = function (t) {
                if (!(t.mp.value >= this.data.nengliang)) throw new Error(" mp.value < nengliang");
                (t.mp.value -= this.data.nengliang), this.cd.enter_cd();
            }),
            (t.prototype.is_ready = function () {
                return this.cd.is_ready();
            }),
            t
        );
    })();
o.default = i;
